﻿@model Isaac.Joy.Identity.Web.DtCms.Models.RoleListViewModel
@{
    Layout = null;
    Model.PageInfor.PageUrl = ((index, size) => Url.Action("Index", new { pi = index, ps = size }));
}

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>会员组列表
    </title>
    <link href="@Url.BundleContent("~/css/pagination.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.BundleContent("~/css/style.css")" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="@Url.BundleContent("~/Scripts/jquery-1.10.2.min.js")"></script>
    <script type="text/javascript" src="@Url.BundleContent("~/Scripts/lhgdialog/lhgdialog.js?skin=idialog")"></script>
    <script type="text/javascript" src="@Url.BundleContent("~/Scripts/layout.js")"></script>
    <script type="text/javascript" src="@Url.BundleContent("~/Scripts/json2.js")"></script>
    <script type="text/javascript" src="@Url.BundleContent("~/Scripts/errorCode.js")"></script>
    <script type="text/javascript" src="@Url.BundleContent("~/Scripts/jqueryStatic.js")"></script>
</head>

<body class="mainbody">
    <!--导航栏-->
    <div class="location">
        <a href="javascript:history.back(-1);" class="back"><i></i><span>返回上一页</span></a>
        <a href="../center.aspx" class="home"><i></i><span>首页</span></a>
        <i class="arrow"></i>
        <span>内容列表</span>
    </div>
    <!--/导航栏-->

    <!--工具栏-->
    <div class="toolbar-wrap">
        <div id="floatHead" class="toolbar">
            <div class="l-list">
                <ul class="icon-list">
                    <li><a class="add" href="@Url.Action("Add")"><i></i><span>新增</span></a></li>
                    <li><a class="all" href="script:;" onclick="checkAll(this);"><i></i><span id="txtall">全选</span></a></li>
                    @*<li><a id="btnSave" class="save" href="javascript:;"><i></i><span>保存</span></a></li>*@
                    <li><a id="btnDelete" class="del" href="javascript:;"><i></i><span>删除</span></a></li>
                </ul>
            </div>
        </div>
    </div>
    <!--/工具栏-->

    <!--文字列表-->

    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="ltable">
        <tr>
            <th width="6%">选择</th>
            <th align="left">角色名称</th>
            <th width="8%">操作</th>
        </tr>
        @{ var rowindex = 0; }
        @foreach (var role in Model.Data)
        {
            <tr>
                @{
            var rowctlid = "rptList_hidId_" + @rowindex;
            var rowchkid = "rptList_chkId_" + @rowindex;
            rowindex++;
                }
                <td align="center">
                    <span class="aspNetDisabled checkall" style="vertical-align: middle;">
                        @if (role.FlagsValue.Enabled(0))
                        {
                            <input id="@rowchkid" type="checkbox" disabled="disabled" name="rptList$ctl01$chkId" />
                        }
                        else
                        {
                            <input id="@rowchkid" type="checkbox" name="rptList$ctl01$chkId" />
                        }
                    </span>
                    <input type="hidden" name="rptList$ctl01$hidId" id="@rowctlid" value="@role.Id" />
                </td>
                <td>
                    <a href="@Url.Action("Edit", new { id = role.Id })">@role.Name</a>
                </td>
                <td align="center">
                    @if (!role.FlagsValue.Enabled(0))
                    {
                        <a href="@Url.Action("Edit", new { id = role.Id })">修改</a>
                    }
                </td>
            </tr>
        }

    </table>

    <!--/文字列表-->

    <!--图片列表-->

    <!--/图片列表-->

    <!--内容底部-->
    <div class="line20"></div>
    @{
        Html.RenderPartial("Page");
    }
    <!--/内容底部-->
</body>
</html>
<script type="text/javascript">
    $(function () {
        $("#btnDelete").click(function () {
            var delString = "";
            for (var i = 0; i < $("#txtPageNum").val() ; i++) {
                if ($("#rptList_chkId_" + i).is(':checked') == true) {
                    var delStr = $("#rptList_hidId_" + i).val();
                    delString += delStr + ",";
                }
            }
            if (delString != "") {
                $.get("@Html.Raw(Url.Action("AjaxDelete"))", { strId: delString }, function (response) {
                    var data = JSON.parse(response);
                    errorCode.getMsg(data, function () {
                        if (data.success) {
                            $.dialog.alert('删除成功！', function () {
                                document.location.reload();
                            }, null, "提示");
                        } else {
                            $.dialog.alert('删除失败！');
                        }
                    }, function (e) {
                        $.dialog.alert(data.msg == '' ? e.msg : data.msg);
                    });
                }, 'text');
            } else {
                $.dialog.alert('请选择要删除的项');
            }
        });
    });
</script>
